Retrieving AttrDefs of selected baselines

I have yet another question.  In my script, I give the user a list of module baselines in a checkboxed listView.  The user must selected 2 of these baselines so that we can compare the DXL attributes between the 2 baselines (we're checking in case there is some sort of corruption when moving a DB from one server to another.)  Here is my code:

void doCompare(DB db) {
    string s = "";
    int numSelected = 0, n;
    innt numAttrs = 0;
    Module mod = null;
    Baseline bLine = null;
    AttrDef ad;
    
    skBL = create();
    skAttrs = create();
    string bl = "";
    
    for (n=0; n < noElems(dbeBaselineSelect); n++) {
        if (getCheck(dbeBaselineSelect, n)) {
            numSelected = numSelected + 1;
            bl = getColumnValue(dbeBaselineSelect, n, 0);
            put(skBL, bl, bl);
        }
    }
    if (numSelected == 2) {
        for (bLine in skBL) do {   //bLine will be string of the baseline
            mod = load(bLine, false);
        }
    } else {
        infoBox("Please select 2 baselines to compare.");
    }
}

When I run this code, however, I end up with a memory violation.  Can someone please help me figure out what I'm doing wrong?

 

Chris


chrscote - Tue Mar 06 13:43:38 EST 2018

Re: Retrieving AttrDefs of selected baselines
davidcs - Tue Mar 06 14:30:25 EST 2018

In skBL you are adding strings (not Baselines) to the skip as the value. Then when looping over skBL you use the variable bLine, which is of type Baseline ... but DOORS is expecting a string variable because that is what you originally stored in the skipList.

Re: Retrieving AttrDefs of selected baselines
chrscote - Wed Mar 07 07:48:26 EST 2018

davidcs - Tue Mar 06 14:30:25 EST 2018

In skBL you are adding strings (not Baselines) to the skip as the value. Then when looping over skBL you use the variable bLine, which is of type Baseline ... but DOORS is expecting a string variable because that is what you originally stored in the skipList.

Oops.  Thanks for the help.